// mock数据模拟
import Mock from "mockjs";

// 图表数据
export default {
  getStatisticalData: () => {
    const series = [];

    //Mock.Random.float 产生随机数100到8000之间 保留小数 最小0位 最大0位
    for (let i = 0; i < 4; i++) {
      let data = [];
      let name = "";
      for (let j = 0; j < 7; j++) {
        data.push(Mock.Random.float(100, 1000, 0, 0));
      }
      switch (i) {
        case 0:
          name = "蛋糕";
          break;
        case 1:
          name = "面包";
          break;
        case 2:
          name = "小食";
          break;
        case 3:
          name = "配件";
          break;
      }
      series.push(
        Mock.mock({
          name,
          type: "line",
          stack: "Total",
          data,
        })
      );
    }
    return {
      code: 2000,
      data: {
        // 饼状图
        userData: [
          {
            date: "周一",
            new: 5,
            active: 200,
          },
          {
            date: "周二",
            new: 10,
            active: 500,
          },
          {
            date: "周三",
            new: 12,
            active: 550,
          },
          {
            date: "周四",
            new: 60,
            active: 800,
          },
          {
            date: "周五",
            new: 65,
            active: 550,
          },
          {
            date: "周六",
            new: 53,
            active: 770,
          },
          {
            date: "周日",
            new: 33,
            active: 170,
          },
        ],
        // 折线图
        orderData: {
          date: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
          series,
        },
        tableData: [
          {
            name: "草莓蛋糕",
            todayBuy: 500,
            monthBuy: 3500,
            totalBuy: 22000,
          },
          {
            name: "男友力",
            todayBuy: 300,
            monthBuy: 2200,
            totalBuy: 24000,
          },
          {
            name: "生日蛋糕",
            todayBuy: 800,
            monthBuy: 4500,
            totalBuy: 65000,
          },
          {
            name: "森林蛋糕",
            todayBuy: 1200,
            monthBuy: 6500,
            totalBuy: 45000,
          },
          {
            name: "茶花蛋糕",
            todayBuy: 300,
            monthBuy: 2000,
            totalBuy: 34000,
          },
          {
            name: "只为遇见",
            todayBuy: 350,
            monthBuy: 3000,
            totalBuy: 22000,
          },
        ],
      },
    };
  },
};
